package com.heihei.itextdemo.controller;


import com.heihei.itextdemo.dto.CommonResponseDTO;
import com.heihei.itextdemo.entity.MajorEntity;
import com.heihei.itextdemo.service.MajorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 专业 前端控制器
 * </p>
 *
 * @author duanhengfei
 * @since 2020-12-04
 */
@RestController
@RequestMapping("/major")
@Api(value = "专业", tags = "专业")
public class MajorController {
    @Resource
    private MajorService majorService;

    /**
     * 添加
     */
    @PostMapping("/save")
    @ApiOperation(value = "添加", notes = "添加")
    public CommonResponseDTO<String> add(@RequestBody MajorEntity entity) {
        return majorService.add(entity);
    }

    /**
     * 获取专业-班级-学生树结构
     */
    @GetMapping("/get-tree")
    @ApiOperation(value = "获取专业-班级-学生树结构", notes = "获取专业-班级-学生树结构")
    public CommonResponseDTO<List<MajorEntity>> getTree() {
        return majorService.getTree();
    }


}
